<?php

declare(strict_types=1);

namespace App\Model\PssLogModel;

use App\Model\BaseModel\BasePssLogModel;
use Service\AppService\IdService;

class MicroServiceQueryLog extends BasePssLogModel
{
    public $table = 'micro_service_query_log';
    
    /**
     * 添加日志
     * @param array $param
     */
    public function addLog( $param = [] )
    {
        return waiter(function() use ($param)
        {
            return $this->add([
                'id'                => IdService::instance()->getLogID(),
                'interface_code'    => $param['interface_code'] ?? '',
                'request_url'       => $param['request_url'] ?? '',
                'request_param'     => $param['request_param'] ?? '',
                'response_code'     => $param['response_code'] ?? '',
                'response_data'     => $param['response_data'] ?? '',
                'req_used_time'     => $param['req_used_time'] ?? '',
                'cd'                => time(),
            ]);
        },120);
    }
}
